Using Open Database Connectivity (ODBC)

These are general guidelines when using ODBC to exchange data between external data sources and your XpertRule application at run time.

Open Database Connectivity (ODBC) can be used to access data from different sources in a consistent way. It provides an industry standard to enable access to data in most of the popular databases, such as Microsoft Access, MS-SQL-Server, Oracle, Sybase and many others, plus spreadsheets such as Microsoft Excel.

ODBC Drivers

To read data from a database you must first have an ODBC driver manager and an appropriate ODBC driver installed on your machine. ODBC drivers are available from a variety of sources. You will need to refer to the documentation provided with such packs to implement ODBC connection to XpertRule - especially relating to Drivers and Data Sources.

Data Sources

A Data Source is a database and connection information used by ODBC. ODBC uses the data source name to refer to a database (it does not use the actual database name).

You will usually be able to connect to ODBC data sources from within XpertRule automatically when you use the @ODBC commands detailed below.

However, this can also be done 'manually' via the 32 bit ODBC Data Source Administrator. In Windows you typically do this by using Start / Settings / Control Panel / Administrative Tools and clicking on the 'Data Sources (ODBC)' icon. From the ODBC Data Source Administrator select the appropriate driver. For example, if you want to link to a Microsoft Access database, select the Microsoft Access driver (*.mdb). Give your data source a name (and an optional description) then locate/select the database. For more help on setting up a data source see the help system from the ODBC Data Source Administrator dialogs.

User ID and Passwords

Some databases require both a user ID and a password in order to access a database. XpertRule ODBC commands always require these items. When accessing databases which do not support these features they should be left blank.

When reading Microsoft Access databases a user ID (and any associated password) must be supplied. This is usually 'Admin' for the user ID with a blank password.

ODBC Commands

Access to databases via ODBC in Knowledge Builder can be implemented via the following commands:

·@ODBCconnect

·@ODBCexecSQL

·@ODBCgetResult

·@ODBCdisconnect

This is a sub-set of the complete ODBC features, but provides enough functionality to query, modify, add and delete records from tables as well as modifying the tables themselves.

A typical sequence of ODBC operations

Using SQL and handling ODBC errors